export function mp4fragment(input: string, output: string) {
  return new Promise((resolve, reject) => {
    NAS.execSync(
      `/usr/local/bin/mp4fragment --fragment-duration 5000 ${input} ${output}`,
    )
      .then(() => {
        resolve(true)
      })
      .catch(() => {
        reject(new Error('fragment 转换失败！'))
      })
  })
}

export function mp4dash(input: string, output: string) {
  return new Promise((resolve, reject) => {
    NAS.execSync(
      `/usr/local/bin/mp4dash --hls --no-split --profile=on-demand ${input} -o ${output}`,
    )
      .then(() => {
        resolve(true)
      })
      .catch(() => {
        reject(new Error('mp4dash 转换失败！'))
      })
  })
}
